/** 
 * Copyright: Copyright (c)2011
 * Company: 易宝支付(YeePay) 
 */
package net.loyintean.pearlshell.validation.rule;

import net.loyintean.pearlshell.validation.IValidRule;
import net.loyintean.pearlshell.validation.IValidRuleConfig;

/** 校验String是否是Double数据格式
 * 
 * @author：jun.lin@yeepay.com
 * @since：2014年12月5日 下午2:58:24
 * @version: */
class StringIsDoubleValidRuleImpl extends StringIsFloatValidRuleImpl implements IValidRule {

	StringIsDoubleValidRuleImpl() {
		super();
	}

	/** 尝试转换为Double格式。如果出错则说明格式错误。
	 * 
	 * @see net.loyintean.pearlshell.validation.rule.
	 *      AbstractStringValidRuleImpl#validString(String, IValidRuleConfig) */
	@Override
	protected boolean validString(String toValid, IValidRuleConfig config) {
		try {
			Double.valueOf(toValid);

		} catch (NumberFormatException e) {
			return false;
		}
		return true;
	}

}
